@import './theme/default';
@import './theme/font';

.zent-form {
  $p: &;

  &-label {
    flex-grow: 0;
    flex-shrink: 0;
    display: inline-flex;
    flex-basis: 120px;

    &.zent-form-label-required {
      &::before {
        @include theme-color(color, error, 2);
        content: '*';
        display: inline-block;
        font-size: 16px;
        margin-right: 6px;
      }
    }
  }

  &-error {
    @include theme-color(color, error, 4);
    margin-top: 4px;
  }

  &-notice,
  &-description {
    @include theme-color(color, stroke, 3);
    line-height: 14px;
    font-size: 12px;
    margin-top: 4px;
    margin-bottom: 0;

    ul li {
      font-size: 12px;
      line-height: 12px;
    }

    a {
      @include theme-color(color, primary, 2);
    }

    &:empty {
      margin-top: 0;
    }
  }

  &-notice {
    @include theme-color(background-color, warn, 5);
    @include theme-color(color, stroke, 1);
    display: inline-block;
    padding: 5px;
  }

  &-control {
    display: flex;
    line-height: 30px;
    margin-bottom: 24px;

    &-content {
      &-inner {
        display: flex;
        & + #{$p}-notice,
        & + #{$p}-description {
          margin-top: 12px;
        }

        & + #{$p}-error {
          margin-top: 8px;
        }
      }
    }

    &.zent-form-checkbox-field,
    &.zent-form-checkbox-group-field,
    &.zent-form-radio-group-field,
    &.zent-form-single-upload-field {
      line-height: 20px;
    }

    &.zent-form-switch-field {
      line-height: 22px;

      // vertical center small switch style
      .zent-form-control-content {
        display: flex;
        align-items: center;
      }
    }
  }

  &-vertical {
    & #{$p}-label {
      flex-basis: auto;
      line-height: 20px;
      margin-bottom: 12px;
      &-empty {
        margin-bottom: 0;
      }
    }

    & #{$p}-control {
      flex-direction: column;

      &-content {
        flex: 0 0 auto;
      }
    }
  }

  &-horizontal {
    & #{$p}-label {
      flex-basis: 120px;
      justify-content: flex-end;
    }

    & #{$p}-control {
      flex-direction: row;

      &-content {
        flex: 1 1 100%;
        margin-left: 8px;
      }
    }

    #{$p}-actions {
      padding: 0 0 0 130px;
      margin: 25px 0 10px;
      background: none;
      border: 0;
    }
  }

  &-direction-row {
    display: flex;
    flex-wrap: wrap;

    #{$p}-control {
      display: inline-flex;
      flex: 1;
    }
  }
}
